package com.mall.czlr.base.util;

import com.mall.czlr.base.exception.GlobalException;

public class Assert {
    public static void isNull(String message, Object bean) {
        if (bean == null) {
            exception(message);
        }
    }

    public static void isNull(Integer type, String message, Object bean) {
        if (bean == null) {
            exception(type, message);
        }
    }

    public static void isNotNull(String message, Object bean) {
        if (bean != null) {
            exception(message);
        }
    }

    public static void isNotNull(Integer type, String message, Object bean) {
        if (bean != null) {
            exception(type, message);
        }
    }

    public static void exception(String message) {
        throw new GlobalException(message);
    }

    public static void exception(Integer type, String message) {
        throw new GlobalException(type, message);
    }
}
